# 允许Docker创建网络分区
sudo firewall-cmd --permanent --new-zone=docker
sudo firewall-cmd --permanent --zone=docker --change-interface=docker0  # 根据实际情况选择正确的接口
sudo firewall-cmd --reload
# 移除原有Docker
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
# 安装Docker前置依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# 添加远端仓库
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 下载Docker
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
#启动docker
sudo systemctl start docker
#查看docker服务状态 running 就是启动成功
sudo systemctl status docker
# 设置开机自启动
sudo systemctl enable docker
# 添加Docker镜像源
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'

{ 
    "registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"]
}
EOF
# 重启Docker
sudo systemctl daemon-reload
sudo systemctl restart docker



